package com.jf.cloud.service.sysmanager.constant;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 资金流水交易类型
 */
public enum TradeType {

    EGG_ADD(10, "加鸡蛋"),EGG_REDUCE(20, "减鸡蛋"),
    CLUB_TO_TEAM_ADD(100, "给战队加"), CLUB_TO_TEAM_REDUCE(110, "从战队减"),
    TEAM_TO_CLUB_REDUCE(120, "从俱乐部减(给战队加)"), TEAM_TO_CLUB_ADD(130, "给俱乐部加(从战队减)"),
    TEAM_TO_MEMBER_ADD(140, "给队员加"), TEAM_TO_MEMBER_REDUCE(150, "从队员减"),
    MEMBER_TO_TEAM_REDUCE(160, "从战队减(给队员加)"), MEMBER_TO_TEAM_ADD(170, "给战队加(从队员减)"),
    MATCH_APPLY_REDUCE(30, "申请加入赛事"),
    MATCH_REFUSE_ADD(40, "拒绝加入赛事"),
    MATCH_CANCEL_REDUCE(50, "取消赛事"),
    MATCH_WIN_ADD(60, "比赛获胜所得"),
    EX_ORDER_SUCCESS(70, "兑换订单完成"),
    EX_ORDER_CANCEL(80, "兑换订单撤销");

    private long key;
    private String value;

    /**
     * 资金流水交易类型
     * @param key   ID
     * @param value 说明
     */
    TradeType(long key, String value) {
        this.key = key;
        this.value = value;
    }

    public long key(){
        return this.key;
    }

    public String value(){
        return this.value;
    }

    /**
     * 获取资金流水交易类型选项列表
     */
    public static List<Map<String, Object>> getTransferTypeList() {
        List<Map<String, Object>> dataDictList = new ArrayList<Map<String, Object>>();
        for (TradeType e : TradeType.values()) {
            Map<String, Object> option = new HashMap<String, Object>();
            option.put("value", e.key());
            option.put("label", e.value());
            dataDictList.add(option);
        }
        return dataDictList;
    }

}
